package ws;

import java.util.Scanner;



public class ws {
	
	static lab[] lab = new lab[6];
	
	
	public static double tax1 = 0.03;
	public static double tax2 = 0.1;
	
	public static double count(double n) {
		double rt=n*tax1+((n-12000)/2+Math.abs((n-12000)/2))*(tax2-tax1);
		return rt;
	}
	public static String rtlevel(int n) {
		String l = null;
		if (n==-1) {l="不合格";} else if(n==1) {l="合格";}else if(n==2) {l="优秀";};
		return l;
	}
	public static double rtmon(int n) {
		double l = 0 ;
		if (n==-1) {l=0;} else if(n==1) {l=60;}else if(n==2) {l=100;};
		return l;
	}
	
	public static void tongji(student s) {
		double m=0;
		System.out.println("学生："+s.name);
		System.out.println("所选工作地点1："+lab[s.lab[0].nam].loc+"  所选工作地点2："+lab[s.lab[1].nam].loc+"  所选工作地点3："+lab[s.lab[2].nam].loc);
		for (int j = 0;j<3;j++) {
		if (s.lab[j].nam<5) {
			System.out.println("所选工作地点"+j+"任务完成情况：");
			for (int i=0;i<18;i++) {
				System.out.println("第"+i+"周"+rtlevel(s.lab[j].week[i].level)+"  补助:"+rtmon(s.lab[j].week[i].level));
				m=m+rtmon(s.lab[j].week[i].level);
			}
		}
	}
		s.money=m;
		System.out.println("总计补助："+m);
		m= count(m); 
		s.afmon=s.money-m;
		m=s.afmon;
		System.out.println("税后补助："+m);
		
	}
    
	public static void main(String[]args){
		{
			for (int i=0;i<6;i++) {
	    		lab[i]=new lab("无");
	    	}
			lab[0].loc="计算机网络实验室";
			lab[1].loc="物理实验室";
			lab[2].loc="化学实验室";
			lab[3].loc="材料实验室";
			lab[4].loc="组成原理实验室";
			lab[5].loc="无";
		}
		student[] stu = new student[4];
			stu[0]= new student("张三",0,0)	;
			stu[1]= new student("李四",0,0)	;
			stu[2]= new student("王五",0,0)	;
			stu[3]= new student("小明",0,0)	;
			
			stu[0].lab[0].nam=2;
			stu[1].lab[0].nam=1;
			stu[2].lab[0].nam=0;stu[2].lab[1].nam=5;stu[2].lab[2].nam=2;
			stu[3].lab[0].nam=4;stu[3].lab[2].nam=3;
			
			
		try(Scanner sc = new Scanner(System.in)){
			System.out.println("选择学生：");
			int select = 0;
			select=sc.nextInt();
            try {
				if (select<0||select>2) throw new Exception();	
            }catch(Exception a) {
            	System.out.println("错误："+a+"。" );
            }
            finally {
            	Boolean i =true;
            	int b = 0;
            	while(i) {
            		int a = select;
            		
						System.out.println("下面请连续输入18次学生"+stu[a].name+"的"+lab[stu[a].lab[b].nam].loc+"的情况,-1为不合格，1为合格，2为优秀。" );
						for (int l=0;l<18;l++) {
							int d;
							System.out.println("第"+(l+1)+"周");
							d=sc.nextInt();
							if (d>2) {d=2;}else if(d<-1) {d=-1;}else if(d==0) {d=-1;}
							stu[a].lab[b].week[l].level=d;
						}
						if(b<2) {
						if (stu[a].lab[b+1].nam==5) {
							b=b+2;
						} else {
							b=b+1;
						}}else if (b==2) {b=b+1;}
						if (b>2) {
							i=false;
						}
            		
            	}
            	tongji(stu[select]);
            }

				
			
		}
	
	}
	
}